#include "pch.h"

void AdjacentCutoff::cutoff(const Board & board, int to_play, int out[200]) {
	int size = board.s();
	if (board.empty() == size * size) {
		return;
	}
	for (int i = 0; i < size; i++) {
		for (int j = 0; j < size; j++) {
			if (board.get(i, j) != Board::EMPTY) {
				continue;
			}

			bool flag = false;
			for (int k = 0; k < NUM; k++) {
				int nx = i + d[k][0];
				int ny = j + d[k][1];
				if (nx >= 0 && nx < size && ny >= 0 && ny < size) {
					if (board.get(nx, ny) != Board::EMPTY) {
						flag = true;
						break;
					}
				}
			}
			if (flag == false) {
				out[i * size + j] = 1;
			}
		}
	}
}